<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<div class="page-header">
							<h1>
						    所有问卷
							</h1>
</div>
<div class="row">
	<div class="col-xs-12">
	  <div class="row">

							<div class="widget-box">
						<div class="widget-header widget-header-small">
								<h5 class="lighter"></h5>
						</div>

						<div class="widget-body">
								<div class="widget-main">
							 <div class="table-responsive">
											<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														
														<th>调查问卷名称</th>
														<th>已参加人数</th>
														<th>题目数目</th>
														<th>详情</th>
														<th>状态</th>
														
														
														<th>
															<i class="icon-time bigger-110 hidden-480"></i>
															添加时间
														</th>
														
														<th>选择参加</th>
													</tr>
												</thead>

												<tbody>
												<?php
												  foreach($surs as $s){
													   $con = '<span class="label label-sm label-warning"><i class="icon-spinner"></i>&nbsp未参加</span>';
													   $attend = '<a target="_blank" href="'.Yii::app()->CreateUrl('stusurvey/survey',array('surveyId'=>$s->surveyId)).'">
															   <button class="btn btn-xs btn-info">
																	<i class="icon-check bigger-120"></i>
																</button>
															  </a>';
													   foreach($stusurs as $stu){
														   if($stu->surveyId == $s->surveyId){
															   $con = '<span class="label label-sm label-success"><i class="icon-ok"></i>&nbsp已参加</span>';
															   $attend = '';
															   break;
														   }
															   
														   
													   }
													 echo '
													<tr>
														<td>
															<a href="#">'.$s->name.'</a>
														</td>
														
														
														
														<td>'.$s->attendnum.'</td>
														<td>'.$s->questionnum.'</td>
														<td>
														   <span display-detail-id="'.$s->surveyId.'" style="display:none;">'.$s->detail.'</span>
															<button class="btn btn-sm btn-info" detail-id="'.$s->surveyId.'">
																详情
															</button>
														</td>
														<td>'.$con.'</td>
														<td>'.$s->addtime.'</td>
														

														
														<td>
															<div class="">
												              '.$attend.'
																
															</div>

														</td>
													</tr>';
												  }
                                                   ?>
												</tbody>
											</table>
										</div><!-- /.table-responsive -->
										<div class="col-xs-12" style="text-align:center">
										     <?php 
											 $this->widget('CLinkPager',array( 
													'htmlOptions'=>array('class'=>'pagination'),
													'cssFile'=>false,
													'header'=>'',    
													'firstPageLabel' => '首页',    
													'lastPageLabel' => '末页',    
													'prevPageLabel' => '上一页',    
													'nextPageLabel' => '下一页',    
													'pages' => $pages,    
													'maxButtonCount'=>13    
												)    
											);    
												
										?>
							         </div>
										</div>
								</div>
							</div>
				</div>
		</div>
</div>
<script type="text/javascript">
   jQuery(function($){
	   
		  <?php
		    if(Yii::app()->user->hasFlash('addsurvey')){
				
				echo 'bootbox.alert("'.Yii::app()->user->getFlash('addsurvey').'",function(){});';
			}
		  ?>
	      
	      $('[detail-id]').on("click",function(){
			var id = $(this).attr('detail-id');
			bootbox.alert($("[display-detail-id = "+id+"]").html(),function(){
				
				
			});
		});
	   
   })
</script>
